
void main() {
  //dynamic类型无限制（会关闭编译器的类型检查），Map与List默认类型都为dynamic类型
  //类型明确时自定义类型来替换掉dynamic类型
  Map categorysA={'name':'tom','age':'18',1:true,false:9999,"hobby":null};
  Map<String,String> categorys={'name':'tom','age':'18'};
  List cartListA = ['衣服','裤子','鞋子',bool,null,Object(),123,false];
  List<String> cartList = ['衣服','裤子','鞋子'];
  print([categorys,cartList,categorysA,cartListA]);

  //泛型封装
  T commonDemo<T> (T param){
    return param;
  }
  //使用泛型封装的函数
  commonDemo('wangkeai');
  commonDemo(18);
  commonDemo(true);

  //异常捕获
  try {
    String name = 'wangkeai';
    if(name !='Lollipop') throw Exception('$name错误,正确名字为Lolliop');
  } catch (e) {
    print(e);
  }
}